{include file="public/header-static"/}
{include file="public/sidebar"/}

<!-- Style -->
<link rel="stylesheet" href="__STATIC__/vendors/select2/css/select2.min.css" type="text/css">


<!-- Style -->
<link rel="stylesheet" href="__STATIC__/vendors/tagsinput/bootstrap-tagsinput.css" type="text/css">


<div id="main">
    {include file="public/header"/}
    <main class="main-content">
        <div class="container">
            {include file="public/page-header"/}
            <div class="row">
                <div class="col-md-12">
                    <div class="card">
                        <div class="card-body">
                            <form action="{:url($kplurl["edit"])}" method="post" target="iframe_form" enctype="multipart/form-data">
                            <input type="hidden" name="id" value="<?php echo input('id'); ?>">
                                {volist name="data" id="data"}
                                    <div class="form-group">
                                        <label for="kplphp_{$key}">{$data['title']}</label>
                                        {if $data['type'] == 'text' || $data['type'] == 'password'}
                                        <input id="kplphp_{$key}" name="{$data['field']}" {if !empty($data['disabled'])} disabled="disabled" {/if}  type="{$data['type']}" value="{$data['value']}" class="form-control" placeholder="{if !empty($data['placeholder'])}{$data['placeholder']}{else /} {$data['title']}  {/if} ">
                                        {elseif $data['type'] == 'switch' /}
                                        <div class="form-group">
                                            <div class="custom-control  custom-switch custom-checkbox-secondary">
                                                <input type="checkbox" id="{$data['field']}_ksetarr_{$key}" name="{$data['field']}" class="custom-control-input" {if !empty($data['disabled'])} disabled="disabled" {/if} {if $data['value'] == 1} checked {/if}>
                                                <label class="custom-control-label" for="{$data['field']}_ksetarr_{$key}">  </label>
                                            </div>
                                        </div>
                                        {elseif $data['type'] == 'select' /}
                                        <div class="form-group">
                                            <select id="kplphp_{$key}" name="{$data['field']}" class="custom-select">
                                                {volist name="data['setarr']" id="setarr"}
                                                <option value="{$key}">{$setarr}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                        {elseif $data['type'] == 'select2' /}
                                        <div class="form-group">
                                            <select id="kplphp_{$key}" name="{$data['field']}" class="custom-select select2-example">
                                                {volist name="data['setarr']" id="setarr"}
                                                <option value="{$key}" {if !empty($data['disabled'])} disabled="disabled" {/if} {if $data['value'] == $key} selected {/if}>{$setarr}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                        {elseif $data['type'] == 'multiple_use' /}
                                        <div class="form-group">
                                            <select id="kplphp_{$key}" name="{$data['field']}" class="custom-select select2-example" multiple>
                                                {volist name="data['setarr']" id="setarr"}
                                                <option  value="{$key}" {if !empty($data['disabled'])} disabled="disabled" {/if} {if $data['value'] == $key} selected {/if}>{$setarr}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                        {elseif $data['type'] == 'checkboxs' /}
                                        <div class="form-group">
                                                {volist name="data['setarr']" id="setarr"}
                                                <div class="custom-control {$data['inline-css']} custom-checkbox custom-checkbox-secondary">
                                                    <input type="checkbox" name="{$data['field']}" value="{$key}" class="custom-control-input" id="customCheck{$key}" {if !empty($data['disabled'])} disabled="disabled" {/if} {if $data['value'] == $key} checked {/if}>
                                                    <label class="custom-control-label" for="customCheck{$key}">{$setarr}</label>
                                                </div>
                                                {/volist}
                                        </div>

                                        {elseif $data['type'] == 'radio' /}
                                        <div class="form-group">
                                            {volist name="data['setarr']" id="setarr"}
                                            <div class="custom-control {$data['inline-css']} custom-radio  custom-checkbox-secondary">
                                                <input type="radio" id="customRadio{$key}" name="{$data['field']}" class="custom-control-input" value="{$key}" {if !empty($data['disabled'])} disabled="disabled" {/if} {if $data['value'] == $key} checked {/if}>
                                                <label class="custom-control-label" for="customRadio{$key}">{$setarr}</label>
                                            </div>
                                            {/volist}
                                        </div>
                                        {elseif $data['type'] == 'tags' /}
                                        <div class="form-group">
                                            <input type="text" class="form-control tagsinput-example" name="{$data['field']}" placeholder="{$data['placeholder']}" value="{$data['exsetarr']}">
                                        </div>
                                        {else /}
                                                <h3>其他扩展</h3>
                                        {/if}
                                        <small class="form-text text-muted">{$data['mean']}</small>
                                    </div>
                                {/volist}
                                <button type="submit" class="btn btn-secondary">提交</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
    {include file="public/footer"/}
</div>

<!-- Plugin scripts -->
<script src="__STATIC__/vendors/bundle.js"></script>
<script>

</script>

<!-- Prism -->
<script src="__STATIC__/vendors/prism/prism.js"></script>

<!-- App scripts -->
<script src="__STATIC__/assets/js/app.min.js"></script>

<!-- Javascript -->
<script src="__STATIC__/vendors/select2/js/select2.min.js"></script>

<!-- Javascript -->
<script src="__STATIC__/vendors/tagsinput/bootstrap-tagsinput.js"></script>
<script>
    $('.select2-example').select2({
        placeholder: 'Select'
    });

    $("input.tagsinput-example").tagsinput('items');
</script>